package online.shenjian.kafka;

import org.apache.kafka.common.serialization.Deserializer;
import org.apache.kafka.common.serialization.Serde;
import org.apache.kafka.common.serialization.Serializer;

public class TransactionSerde implements Serde<Transaction> {
  private final Serializer<Transaction> serializer;
  private final Deserializer<Transaction> deserializer;

  public TransactionSerde() {
    serializer = new JsonSerializer<>();
    deserializer = new JsonDeserializer<>(Transaction.class);
  }

  @Override
  public Serializer<Transaction> serializer() {
    return serializer;
  }

  @Override
  public Deserializer<Transaction> deserializer() {
    return deserializer;
  }
}
